//引入createRouter函数
import {createRouter, createWebHistory} from 'vue-router'
//引入路由组件
import IndexView from '@/pages/index.vue'
import IndexmainView from "@/pages/indexmain.vue";

import ImageView from '@/pages/image.vue'

import AdminView from '@/pages/admin.vue'
import MainView from '@/pages/Main.vue'
import CustomView from '@/pages/Custom.vue'
import DataView from '@/pages/Data.vue'
import SortView from '@/pages/Sort.vue'
import OrderView from '@/pages/Order.vue'

import UserView from "@/pages/user.vue";
import PersonView from '@/pages/person.vue'
import MypersonView from "@/pages/myperson.vue";
import MessageView from "@/pages/message.vue";
import AddressView from "@/pages/address.vue";
import InformationView from "@/pages/information.vue";
import DetailsView from "@/pages/details.vue";
import CarView from '@/pages/car.vue'
import SalegoodsView from "@/pages/salegoods.vue";

//创建路由器实例
const router=createRouter({
    history:createWebHistory(),
    //路由
    routes:[
        {
            path:"/",
            component:IndexView,
            children:[
                {
                    path:"",
                    component:IndexmainView
                }
            ]
        },
        {
            path:"/admin",
            component:AdminView,
            children:[
                {
                    path:'/main',
                    component:MainView
                },
                {
                    path:'/custom',
                    component:CustomView
                },
                {
                    path:'/data',
                    component:DataView,
                },
                {
                    path:'/sort',
                    component:SortView,
                },
                {
                    path:'/order',
                    component:OrderView,
                },
            ]
        },
        {
            path:"/user",
            component:UserView,
            children:[
                {
                    path:"",
                    component:IndexmainView
                },
                {
                    path:"person",
                    component:PersonView,
                    children:[
                        {
                            path:"myperson",
                            component:MypersonView
                        },
                        {
                            path:"message",
                            component:MessageView
                        },
                        {
                            path:"address",
                            component:AddressView
                        },
                        {
                            path:"information",
                            component:InformationView
                        }
                    ]
                },
                {
                    path: "details",
                    component: DetailsView
                },
                {
                    path: "car",
                    component: CarView
                },
                {
                    path: "salegoods",
                    component: SalegoodsView
                },
            ]
        },
        {
            path:"/image",
            component:ImageView
        }
    ]
})
//暴露路由器实例
export default router;